<template>
  <div class="collect-page">
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <article-item v-for="item in list" :key="item.id" :item="item" />
    </van-list>
  </div>
</template>

<script>
import { getOptList } from '@/api/interview'
export default {
  name: 'article-page',
  data() {
    return {
      list: [],
      loading: false,
      finished: false,
      page: 1
    }
  },
  methods: {
    changeTab() {
      this.page = 1
      this.list = []
      this.loading = false
      this.finished = false
      this.onLoad()
    },
    async onLoad() {
      const res = await getOptList({
        optType: 2,
        page: this.page,
        pageSize: 10
      })
      this.page++
      this.list.push(...res.data.rows)
      // console.log(this.list)
      this.loading = false
      if (this.list.length >= res.data.total) {
        this.finished = true
      }
    }

  }
}
</script>

<style lang="less" scoped>
.collect-page {
  margin-bottom: 50px;
  margin-top: 44px;
}
</style>
